import axios from '@/lib/script/http'

const getBaseUrl = () => {
  return ''
}

// 获取验证码
export const getSecurityCode = () => {
  return new Promise((resolve, reject) => {
    axios({
      url: getBaseUrl() + `/common/getCaptcha`,
      method: 'GET',
      noToken: true,
    }).then((resp: any) => {
      resolve(resp)
    }, reject)
  })
}

// 注册
export const postRegister = (args: any) => {
  return new Promise((resolve, reject) => {
    axios({
      url: getBaseUrl() + `/common/register`,
      method: 'POST',
      data: args,
      noToken: true,
    }).then((resp: any) => {
      resolve(resp)
    }, reject)
  })
}

// 登录
export const postLogin = (args: any) => {
  return new Promise((resolve, reject) => {
    axios({
      url: getBaseUrl() + `/common/login`,
      method: 'POST',
      data: args,
      noToken: true,
    }).then((resp: any) => {
      resolve(resp)
    }, reject)
  })
}

